﻿using Engine;
using Engine.Graphics;
using Game;
using System.Collections.Generic;

namespace Mekiasm
{
    public class OreCrystal : ItemFlat
    {
        public static int Index;

        public OreCrystal() : base("水晶原矿",null)
        {
            texture2D = ContentManager.Get<Texture2D>("Mekiasm/Textures/Items/资源/large_quartz_bud");
        }
        public override bool IsFaceTransparent(SubsystemTerrain subsystemTerrain, int face, int value)
        {
            return true;
        }
        public override void GetDropValues(SubsystemTerrain subsystemTerrain, int oldValue, int newValue, int toolLevel, List<BlockDropValue> dropValues, out bool showDebris)
        {
            dropValues.Add(new BlockDropValue() { Value = Crystal.Index, Count = 2 });
            showDebris = true;
        }
        public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData)
        {
            BlocksManager.DrawFlatBlock(primitivesRenderer, value, size, ref matrix, texture2D, Color.White, false, environmentData);
        }
        public override void GenerateTerrainVertices(Block block, BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            generator.GenerateCrossfaceVertices(block, value, x, y, z, Color.White, 0, geometry.GetGeometry(texture2D).SubsetAlphaTest);
        }
        public override int GetTextureSlotCount(int value)
        {
            return 1;
        }
        public override bool IsPlaceable_(int value)
        {
            return true;
        }
        public override bool OnUse(Ray3 aim, ComponentMiner componentMiner, TerrainRaycastResult? raycast)
        {
            return false;
        }
    }
}

